package com.suncp.service.impl;

import com.suncp.dao.BookMapper;
import com.suncp.entity.Books;
import com.suncp.service.BookService;

import java.util.List;

/**
 * @author suncp
 * @date 2020/12/1 10:16
 */
public class BookServiceImpl implements BookService {

    //service 层调dao层: 组合dao
    private BookMapper bookMapper;

    public void setBookMapper(BookMapper bookMapper) {
        this.bookMapper = bookMapper;
    }

    @Override
    public void addBook(Books books) {
        bookMapper.addBook(books);
    }

    @Override
    public void deleteBookById(int bookId) {
        bookMapper.deleteBookById(bookId);
    }

    @Override
    public void updateBook(Books books) {
        bookMapper.updateBook(books);
    }

    @Override
    public Books queryBookById(int bookId) {
        return bookMapper.queryBookById(bookId);
    }

    @Override
    public List<Books> queryAllBook() {
        return bookMapper.queryAllBook();
    }

    /**
     * 根据书名查询书籍
     *
     * @param bookName 书籍名称
     * @return
     */
    @Override
    public List<Books> queryBookByName(String bookName) {
        return bookMapper.queryBookByName(bookName);
    }
}
